package com.example.indenture.company.dao;

import com.example.indenture.company.entity.Article;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: wyt
 * @Date: 2023/6/10 18:12
 **/
@Repository
@Mapper
public interface ArticleDao {
    @Insert("INSERT INTO article(title, content, cid, rid,create_date,update_time) " +
            "VALUES(#{title}, #{content}, #{cid},#{rid},#{createDate},#{updateTime})")
    Integer insertArticle(Article article);

    @Delete("DELETE FROM article WHERE cid = #{cid} AND rid = #{rid}")
    Integer deleteArticleByCidAndRid( Integer cid,  Integer rid);

    @Select("SELECT * FROM article WHERE cid = #{cid} AND rid = #{rid}")
    List<Article> getArticleByCidAndRid( Integer cid,  Integer rid);

}